﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kpmg.CompanyInfo;

namespace Ordering
{
    public class ShopOM
    {
        public static void AddShop(Shop obj, string oper)
        {
            //Check input parameter
            if (obj == null || String.IsNullOrEmpty(oper))
                throw new Exception("ShopOM.AddShop::Invalid input parameter");

            Staff objUsr = StaffDAO.GetObjectByUserId(oper);
            if (objUsr == null)
                throw new Exception("ShopOM.AddShop::Invalid operator");

            if( ! ShopDAO.IsShopNameExist(obj.Shop_Name))
                throw new Exception("ShopOM.AddShop::ShopName has exists");

            ShopDAO.AddShop(obj);
            LogUtil.LogEvent(obj.Shop_Id, EventAction.AddShop, oper, obj.ToDictionary());
        }
    }
}
